home *** CD-ROM | disk | FTP | other *** search
- ' -- TERM_IO.PAS --
- '
- ' This program is donated to the Public
- ' Domain by MarshallSoft Computing, Inc.
- ' It is provided as an example of the use
- ' of the Personal Communications Library.
- '
-
- DefInt A-Z
-
- '$INCLUDE: 'PCL4B.BI'
- '$INCLUDE: 'TERM_IO.BI'
-
- Const CR = 13, ESC = 27, BS = 8
- Const BLK = 32, CAN = 24
-
- Const LowVideo = 7
- Const HighVideo = 1
-
- '** match baud rate string
-
- '** Transmits CAN's **
-
- '** read message form line 25 **
-
- '** write onto line 25
-
-
- Function MatchBaud (BaudString$)
- MatchBaud = -1
- If BaudString$ = "300" Then MatchBaud = 0
- If BaudString$ = "600" Then MatchBaud = 1
- If BaudString$ = "1200" Then MatchBaud = 2
- If BaudString$ = "2400" Then MatchBaud = 3
- If BaudString$ = "4800" Then MatchBaud = 4
- If BaudString$ = "9600" Then MatchBaud = 5
- If BaudString$ = "19200" Then MatchBaud = 6
- If BaudString$ = "38400" Then MatchBaud = 7
- If BaudString$ = "57600" Then MatchBaud = 8
- If BaudString$ = "115200" Then MatchBaud = 9
- End Function
-
- Sub ReadMsg (MsgString$, ByVal StartCol, ByVal MaxLength)
- I = 0
- Row = CSRLIN
- Col = POS(0)
- VIEW PRINT 25 TO 25
- COLOR HighVideo
- MsgString$ = ""
- 'input text from user
- LOCATE 25, StartCol, 1
- Do
- AnyKey$ = INKEY$
- If AnyKey$ <> "" Then
- Select Case Left$(AnyKey$, 1)
- Case Chr$(13)
- COLOR LowVideo
- VIEW PRINT 1 TO 24
- LOCATE Row, Col, 1
- Exit Sub
- Case Chr$(27) 'Escape
- 'return empty string
- MsgString$ = ""
- COLOR LowVideo
- VIEW PRINT 1 TO 24
- LOCATE Row, Col, 1
- Exit Sub
- Case Chr$(8) 'backspace
- 'back up if can
- If I > 0 Then
- 'adjust buffer
- I = I - 1
- MsgString$ = Left$(MsgString$, Len(MsgString$) - 1)
- 'write blank at cursor
- LOCATE 25, StartCol + I, 1
- Print " ";
- LOCATE 25, StartCol + I, 1
- End If
- Case Else 'not one of above special chars
- 'display on bottom line
- LOCATE 25, StartCol + I, 1
- Print AnyKey$;
- 'save character
- I = I + 1
- MsgString$ = MsgString$ + AnyKey$
- 'done ?
- If I >= MaxLength Then
- VIEW PRINT 1 TO 24
- COLOR LowVideo
- LOCATE Row, Col, 1
- Exit Sub
- End If
- End Select
- End If
- Loop
- End Sub
-
- Sub TxCAN (ByVal Port)
- For I = 1 To 6
- Code = SioPutc(Port, CAN)
- Next I
- End Sub
-
- Sub WriteMsg (MsgString$, ByVal StartCol)
- Col = POS(0)
- Row = CSRLIN
- VIEW PRINT 25 TO 25
- COLOR HighVideo
- LOCATE 25, StartCol, 1
- Print String$(40, " ");
- LOCATE 25, StartCol, 1
- Print MsgString$;
- VIEW PRINT 1 TO 24
- COLOR LowVideo
- LOCATE Row, Col, 1
- End Sub
-
-